<script>
    function check(no){

          var objcekbok = document.getElementById("semester"+no);
          if(objcekbok.checked){
              var awal=document.getElementById("sisa").value;

              for(i=awal;i<=no;i++){
                  var str="semester"+i;
                  var obj = document.getElementById(str);
                  obj.checked=true;
              }
          }else{
              for(j=no+1;j<=8;j++){
                  var str="semester"+j;
                  var obj = document.getElementById(str);
                  obj.checked=false;
              }
          }
    }
</script>

<center>
    <div class="contentIsi">
        <?php $this->load->view('panel_samping') ?>
		
		<div class="isi">
            <div class="biodata">
				<div class="title_biodata">
					<br/>
					Biodata Mahasiswa
					<br/>
				</div>
				<div class="item_biodata">
					<span class="label_biodata">NIM : </span>
					<span class="content_biodata"><?php echo $row['nim'] ?></span>
				</div>
				<div class="item_biodata">
					<span class="label_biodata">Nama : </span>
					<span class="content_biodata"><?php echo ucwords(strtolower($row['nama'])) ?></span>
                </div>
				<div class="item_biodata">
					<span class="label_biodata">Fakultas : </span>
					<span class="content_biodata"><?php echo strtoupper($row['fakultas']) ?></span>
                </div>
				<div class="item_biodata">
					<span class="label_biodata">Prodi : </span>
					<span class="content_biodata">
					<?php 
						if($row['prodi']==''){
							echo 'Belum ada prodi';
						}else{
							echo ucwords(strtolower($row['prodi']));
						}
					?>
					</span>
                </div>
				<div class="item_biodata">
					<span class="label_biodata">Angkatan : </span>
					<span class="content_biodata"><?php echo $row['angkatan'] ?></span>
                </div>
				<div class="item_biodata">
					<span class="label_biodata">Asal : </span>
					<span class="content_biodata">
						<?php 
						if($row['asal']==''){
							echo '-';
						}else{
							echo $row['asal'];
						}
						?>
					</span>
                </div>
				<div class="item_biodata">
					<span class="label_biodata">Semester : </span>
					<span class="content_biodata"><?php echo $row['semester'] ?></span>
				</div>
				<div class="item_biodata">
					<span class="label_biodata">SPP : </span>
					<span class="content_biodata">Rp <?php echo number_format($row['spp'],2,'.',',') ?></span>
				</div>
				<div class="item_biodata">
					<span class="label_biodata">Status Tunda : </span>
					<span class="content_biodata">
						<?php if($row['statustunda']=='t'){ ?>
                                    Ya
                            <?php }else{ ?>
                                    Tidak
                            <?php } ?>
					</span>
				</div>
				<div class="item_biodata">
					<form action="<?php echo base_url()?>home/donasikan" method="post">
						<h1>Beasiswa</h1>
						<br/>
						<?php
							for($i=1;$i<=$semester;$i++)
								echo 'Semester ' . $i . '<br/>';
							for($i=$semester+1;$i<=8;$i++)
								echo '<input onclick="check('.$i.')" type="checkbox" id="semester' . $i . '" name="semester' . $i . '"/> Semester ' . $i . '<br/>';
						?>
						<input type="hidden" name="spp" id="spp" value="<?php echo $row['spp']?>"/>
						<input type="hidden" name="sisa" id="sisa" value="<?php echo $sisa?>"/>
						<input type="hidden" name="idmhs" value="<?php echo $row['idmhs']?>"/>
						<br/>
						<input type="submit" value="Donasikan" class="button"/>
					</form>
				</div>
				<br/>
			</div>
		</div>
        <?php $this->load->view('panel_kanan') ?>
    </div>

</center>
